<template>
    <div id="repulseList">
      <ul v-if="listData.length>0">
        <li
          v-for="(item,index) in listData"
          :key="index"
          @click="listClick(item)">
          <p style="font-weight: bold; height: 30px">
            <span style="float: left">{{ item.SIGNERNAME }}</span>
            <span style="float: right">{{ item.SIGNERNAME }}</span>
          </p>
          <p style="font-size: 14px; color: #848484; height: 30px">
            <span style="float: left">打回意见：{{ item.DHLY | inUseName(DHLX)}}</span>
            <span style="float: right" >{{ item.SIGNDATE }}</span>
            <!--<span style="float: right" >联系电话：{{item.LXDR}}</span>-->
          </p>
          <p style="font-size: 14px; color: #848484; height: 30px">
            <span style="float: left">地址：{{ item.CONSTRUCITONADDRESS }}</span>
          </p>
        </li>
      </ul>
      <ul v-else>
        <div style="height: 60vh;text-align:center;padding-top: 20vh;">
          <div style="margin-bottom: 10px;">
            <img src="https://nfzjszlb.jst.zj.gov.cn/serverfile/zheliban/icon/DSF/50.png" />
          </div>
          <div>暂无数据</div>
        </div>
      </ul>
    </div>
</template>

<script>
  import { FileServerProxy } from '@/utils/api'
  export default {
    name: "repulseList",
    filters: {
      inUseName: function(msg, data) {
        let name = ''
        data.forEach(item => {
          if (item.DICID == msg) {
            name = item.DICNAME
          }
        })
        return name
      },
    },
    data(){
      return{
        listData:[],
        DHLX:[]
      }
    },
    methods:{
      getListData: async function () {
        let params = {
          accessCode: '688bd3883572440a859dfd8ba9194e7b',
          cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
          params: {
            dataguid: '0cfcb45a-d23a-4996-af3e-bdecd232d314',
            searchObject: JSON.stringify([]),
            token: window.localStorage.getItem('token')
          }
        }
        const res = await FileServerProxy(params)
        this.listData = JSON.parse(res.data.data).Data
      },
      listClick(data){
        this.$router.push({
          path: '/repulseDetail',
          query: { data: JSON.stringify(data)}
        })
      },
      getEnum: async function (viewID) {
        let params = {
          accessCode: "688bd3883572440a859dfd8ba9194e7b",
             cityCode: window.localStorage.getItem("citycode")
              ? window.localStorage.getItem("citycode")
              : "441300000000",
          params: {
            dataguid: viewID,
            searchObject: JSON.stringify([]),
            token: window.localStorage.getItem("token"),
          },
        };
        const res = await FileServerProxy(params);
        switch (viewID) {
          case "67176c5f-ebad-4f7b-9cb4-d2a926f511cf":
            this.DHLX = JSON.parse(res.data.data).Data
            break;
          default:
            break;
        }
      },
    },
    mounted(){
      this.getEnum('67176c5f-ebad-4f7b-9cb4-d2a926f511cf')
      this.getListData()
    }
  };
</script>

<style scoped lang="scss">
#repulseList{
  height: 100vh;
  overflow: auto;
  padding: 10px;
  ul li {
    padding-top: 10px;
    border-bottom: 1px solid #d2d2d2;
  }
}
</style>
